package com.example.administrator.yunniuusedcar.mineModular;

import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.administrator.yunniuusedcar.adapter.MainAdapter;
import com.example.administrator.common.base.BaseActivity;
import com.example.administrator.yunniuusedcar.fragment.Mine_Fragment.ActionCXShouCang;
import com.example.administrator.yunniuusedcar.fragment.Mine_Fragment.EScatShouCang;
import com.example.administrator.yunniuusedcar.fragment.Mine_Fragment.HaoGrildShouCang;
import com.example.administrator.yunniuusedcar.fragment.Mine_Fragment.JFshoopShouCanga;
import com.example.administrator.yunniuusedcar.fragment.Mine_Fragment.LCcarShouCang;
import com.example.administrator.yunniuusedcar.fragment.Mine_Fragment.PJcarShouCang;
import com.example.administrator.yunniuusedcar.fragment.Mine_Fragment.ZGcarShouCang;
import com.example.administrator.yunniuusedcar.fragment.Mine_Fragment.ZiXunShouCang;
import com.example.administrator.yunniuusedcar.R;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2017/12/9.
 * 我的收藏  (Tablayout +  fragment)
 */
public class ActivityMineCollection extends BaseActivity{
    private android.widget.RelativeLayout LLTitle;
    private android.widget.ImageView ivBack;
    private android.widget.TextView tvBianJi;
    private android.support.design.widget.TabLayout tbShouCangPager;
    private ViewPager vpShouCang;


    @Override
    public int getLayoutRes() {
        return R.layout.activity_mine_collection;
    }

    @Override
    public void initView() {

        initFindViByID();
        iniyPager();

    }
      String[] titlse = { "中规豪车","平进进口","理财购车","二手豪车",
                              "豪车精品","活动促销","积分商城","资讯"};
    private void iniyPager() {
        List<Fragment> fg = new ArrayList<>();
        fg.add(new ZGcarShouCang());   //中规豪车 收藏
        fg.add(new PJcarShouCang());
        fg.add(new LCcarShouCang());
        fg.add(new EScatShouCang());
        fg.add(new HaoGrildShouCang());  //豪车精品
        fg.add(new ActionCXShouCang());
        fg.add(new JFshoopShouCanga());
        fg.add(new ZiXunShouCang());

        MainAdapter mD = new MainAdapter(getSupportFragmentManager(),fg,titlse);
        vpShouCang.setAdapter(mD);


    }

    private void initFindViByID() {
        ivBack = (ImageView) findView(R.id.iv_back);
        tvBianJi = (TextView) findView(R.id.tv_BianJi);
        tbShouCangPager = (TabLayout) findView(R.id.tb_ShouCangPager);   //TabLayout
        //ViewPager
        vpShouCang = findView(R.id.vp_ShouCang);

        tbShouCangPager.setupWithViewPager(vpShouCang);
    }



    @Override
    public void initListener() {
        ivBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
    }

    @Override
    public void initData() {

    }
}
